package com.hxkj;

import com.alibaba.fastjson.JSONObject;
import com.hxkj.domain.po.FunctionLibrary;
import com.hxkj.domain.po.FunctionLibraryTree;
import com.hxkj.service.FunctionLibraryService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName FunctionLib
 * @Description TODO
 * @Author Mr.zheng
 * @Date 2018/6/27 19:07
 * @Version 1.0
 */
@SpringBootTest
@RunWith(SpringRunner.class)
@Slf4j
public class FunctionLib {

    @Resource
    private FunctionLibraryService functionLibraryService;

    @Test
    public void functionToSite(){

        try {
            FunctionLibrary functionLibrary = new FunctionLibrary();
            functionLibrary.setSiteId(123462L);
            functionLibrary.setIds("881,883,884");
            log.info("用户信息为:{}", JSONObject.toJSON(functionLibrary));
            functionLibraryService.functionToSite(functionLibrary);
        } catch (Exception e) {
            e.printStackTrace();
            log.info("用户信息为:{}", 1);
        }
    }

    @Test
    public void getShowFunctionLibraryListTree(){

        try {
            FunctionLibrary functionLibrary = new FunctionLibrary();
            functionLibrary.setSiteIds("123462");
            log.info("用户信息为:{}", JSONObject.toJSON(functionLibrary));
            List<FunctionLibraryTree> functionLibraryTreeList =  functionLibraryService.getShowFunctionLibraryListTree(functionLibrary);
            log.info("用户信息为:{}", JSONObject.toJSON(functionLibraryTreeList));
        } catch (Exception e) {
            e.printStackTrace();
            log.info("用户信息为:{}", 1);
        }
    }
}
